<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0
        }

        div.content {
            width: 600px;
            height: 400px;
            border: 1px solid #333;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
        }

        .content img {
            position: absolute;
            left: 0;
            top: 0;
        }

        .content img:first-child {
            z-index: 1;
        }

        .btn-group {
            position: absolute;
            width: 100%;
            z-index: 20;
            text-align: center;
            bottom: 30px;
        }

        .btn-group span {
            display: inline-block;
            width: 30px;
            height: 30px;
            background: #fff;
            border: 1px solid #333;
            border-radius: 50%;
            cursor: pointer;
        }

        .btn-group .current {
            background: chocolate;
        }
    
    </style>
</head>

<body>
    <div class="content">
        <div>
            <img src="images/01.png" alt="">
            <img src="images/02.png" alt="">
            <img src="images/03.png" alt="">
            <img src="images/04.png" alt="">
            <img src="images/05.png" alt="">
        </div>

        <div class="btn-group">
            <span class="current"></span>
            <span></span>
            <span></span>
            <span></span>
            <span></span>

        </div>
    </div>
    
    <script>
        $(".btn-group span").click(function () {
            /* 1.点击当前元素添加class,给兄弟元素移除class */
            $(this).addClass("current").siblings().removeClass("current");
            var index = $(this).index();
            console.log(index);
            /* 2.点击对应按钮,对应图片显示 */
            $("img").eq(index).fadeIn(1000).siblings().fadeOut(1000);
        })
    </script>
    
</body>

</html>